<?php
	require_once("../classes/Qualification.php");
	require_once("../classes/User.php");
	
	session_start();
	
	$user = $_SESSION["user"];
	
	$qualification = new Qualification($user->getId(), $_POST["school"], $_POST["course"], $_POST["startdate"], $_POST["enddate"]);
	
	if(isset($_POST["id"])){
		$qualification->setId($_POST["id"]);
	}
	
	$state = $qualification->save();
	
	if($state == 2){
		$_SESSION["msg"] = "Dados Gravados.";
		header("Location: ../addQualifications.php");
	}else{
		$_SESSION["msg"] = "Dados Alterados.";
		header("Location: ../changeQualifications.php");
	}
?>